﻿@ModelType List(Of SistemaINCA.GET_RESUMEN_NOTAS_PERIODO_ACTIVO_BYALUMNO_DATATYPE)

<h3>@ViewBag.Titulo_Periodo</h3>
<table @ViewBag.Periodo id="table-alum-notas" @ViewBag.Año>
    <thead>
        <tr>
            <td style="background: white;"></td>
            <td class="col-tit-cols" style="background: white;" title="Actividad 1">A1 (@Model.Item(Model.Count -1).A1%)</td>
            <td class="col-tit-cols" style="background: white;" title="Actividad 2">A2 (@Model.Item(Model.Count - 1).A2%)</td>
            <td class="col-tit-cols" style="background: white;" title="Auto Evaluación">AE (@Model.Item(Model.Count - 1).AE%)</td>
            <td class="col-tit-cols" style="background: white;" title="Hetero Evaluación">HE (@Model.Item(Model.Count - 1).HE%)</td>
            <td class="col-tit-cols" style="background: white;" title="Prueba Objetiva">PO (@Model.Item(Model.Count - 1).PO%)</td>
            <td class="col-tit-cols" style="background: white;" title="Promedio Final">PROM</td>
        </tr>
    </thead>
    @code
        Dim strDefault As String = "--"
        Dim prom As Decimal
        Dim attr As String
        
        Dim po As Decimal
        Dim he As Decimal
        Dim ae As Decimal
        Dim a2 As Decimal
        Dim a1 As Decimal
        Dim attrMateria As String
    End Code

    <tbody id="rows-notas">
    @For i As Integer = 0 To Model.Count - 2
        attrMateria = String.Format("data-id-materia={0}", Model.Item(i).ID_MATERIA)
            @<tr @attrMateria onclick="rowClick(this)" title="">
                <td class="col-titulos" style="text-align:left;">@Model.Item(i).MATERIA</td>
                <td class="col-datos" style="text-align:center;">
                    @If Not IsNothing(Model.Item(i).A1) Then
                        @Model.Item(i).A1.Value.ToString("#0.00")
                    Else
                        @strDefault
                    End If
                </td>
                <td class="col-datos" style="text-align:center;">
                    @If Not IsNothing(Model.Item(i).A2) Then
                        @Model.Item(i).A2.Value.ToString("#0.00")
                    Else
                        @strDefault
                    End If
                </td>
                <td class="col-datos" style="text-align:center;">
                    @If Not IsNothing(Model.Item(i).AE) Then
                        @Model.Item(i).AE.Value.ToString("#0.00")
                    Else
                        @strDefault
                    End If
                </td>
                <td class="col-datos" style="text-align:center;">
                    @If Not IsNothing(Model.Item(i).HE) Then
                        @Model.Item(i).HE.Value.ToString("#0.00")
                    Else
                        @strDefault
                    End If
                </td>
                <td class="col-datos" style="text-align:center;">
                    @If Not IsNothing(Model.Item(i).PO) Then
                        @Model.Item(i).PO.Value.ToString("#0.00")
                    Else
                        @strDefault
                    End If
                </td>

                @code
                    po = If(IsNothing(Model.Item(i).PO), 0, Model.Item(i).PO.Value)
                    he = If(IsNothing(Model.Item(i).HE), 0, Model.Item(i).HE.Value)
                    ae = If(IsNothing(Model.Item(i).AE), 0, Model.Item(i).AE.Value)
                    a2 = If(IsNothing(Model.Item(i).A2), 0, Model.Item(i).A2.Value)
                    a1 = If(IsNothing(Model.Item(i).A1), 0, Model.Item(i).A1.Value)
                
                    prom = po * (Model.Item(Model.Count - 1).PO.Value / 100) +
                    he * (Model.Item(Model.Count - 1).HE.Value / 100) +
                    ae * (Model.Item(Model.Count - 1).AE.Value / 100) +
                    a2 * (Model.Item(Model.Count - 1).A2.Value / 100) +
                    a1 * (Model.Item(Model.Count - 1).A1.Value / 100)
            
                    attr = String.Format("Nota={0}", Math.Round(prom, 1))
                End Code
                <td @attr class="col-datos-total">
                    @Math.Round(prom,1).ToString("#0.0")
                </td>
            </tr>
    Next
    </tbody>
</table>

<div id="leyenda">
    <div class="col-titulos" style="margin: 5px 5px 5px 5px; text-align:left;">Donde:</div>
    <ul>
        <li class="col-titulos">A1:</li>
        <li class="col-datos" style="text-align:left; padding-right: 20px;">Actividad No. 1</li>
        <li class="col-titulos">A2:</li>
        <li class="col-datos" style="text-align:left; padding-right: 20px;">Actividad No. 2</li>
        <li class="col-titulos">AE:</li>
        <li class="col-datos" style="text-align:left; padding-right: 25px;">Auto Evaluación</li>
        <li class="col-titulos">HE:</li>
        <li class="col-datos" style="text-align:left; padding-right: 12px;">Hetero Evaluación</li>
        <li class="col-titulos">PO:</li>
        <li class="col-datos" style="text-align:left; padding-right: 12px;">Prueba Objetiva</li>
        <li class="col-titulos">PROM:</li>
        <li class="col-datos" style="text-align:left;">Promedio Final</li>
    </ul>
</div>
